package com.junzerg.tooltip.controller.response;

import com.alibaba.fastjson.annotation.JSONField;
import com.junzerg.tooltip.constant.Constant;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

/**
 * @author pengjz <br>
 * @version 1.0 <br>
 * @description PoiEntity <br>
 * @date 2022/4/10 17:01 <br>
 */
@Data
public class PoiEntity {

    private String id;
    private String parent;
    private String name;
    private String type;
    private String typecode;
    @JSONField(name = "biz_type")
    private String bizType;
    private String address;
    private String location;
    private String distance;
    private String tel;
    private String postcode;
    private String website;
    private String email;
    private String pcode;
    private String pname;
    private String citycode;
    private String cityname;
    private String adcode;
    private String adname;
    @JSONField(name = "entr_location")
    private String entrLocation;
    @JSONField(name = "exit_location")
    private String exitLocation;
    @JSONField(name = "navi_poiid")
    private String naviPoiid;
    private String gridcode;
    private String alias;
    @JSONField(name = "business_area")
    private String businessArea;
    @JSONField(name = "parking_type")
    private String parkingType;
    private String tag;
    @JSONField(name = "indoor_map")
    private String indoorMap;
    @JSONField(name = "indoor_data")
    private String indoorData;
    @JSONField(name = "groupbuy_num")
    private String groupbuyNum;
    @JSONField(name = "discount_num")
    private String discountNum;
    @JSONField(name = "biz_ext")
    private String bizExt;
    private String photos;

    public Map<String, Object> toMap() {
        Map<String, Object> map = new HashMap<>();
        if (this.id != null) {
            map.put("id", this.id);
        }
        if (this.parent != null) {
            map.put("parent", this.parent);
        }
        if (this.name != null) {
            map.put("name", this.name);
        }
        if (this.type != null) {
            map.put("type", this.type);
        }
        if (this.typecode != null) {
            map.put("typecode", this.typecode);
        }
        if (this.bizType != null) {
            map.put("bizType", this.bizType);
        }
        if (this.address != null) {
            map.put("address", this.address);
        }
        if (this.location != null) {
            Map<String, Object> locationMap = new HashMap<>(2, 1);
            String[] arr = this.location.split(Constant.AMAP.LOCATION_SPLITTER);
            locationMap.put("lon", arr[0]);
            locationMap.put("lat", arr[1]);
            map.put("location", locationMap);
        }
        if (this.distance != null) {
            map.put("distance", this.distance);
        }
        if (this.tel != null) {
            map.put("tel", this.tel);
        }
        if (this.postcode != null) {
            map.put("postcode", this.postcode);
        }
        if (this.website != null) {
            map.put("website", this.website);
        }
        if (this.email != null) {
            map.put("email", this.email);
        }
        if (this.pcode != null) {
            map.put("pcode", this.pcode);
        }
        if (this.pname != null) {
            map.put("pname", this.pname);
        }
        if (this.citycode != null) {
            map.put("citycode", this.citycode);
        }
        if (this.cityname != null) {
            map.put("cityname", this.cityname);
        }
        if (this.adcode != null) {
            map.put("adcode", this.adcode);
        }
        if (this.adname != null) {
            map.put("adname", this.adname);
        }
        if (this.entrLocation != null) {
            map.put("entrLocation", this.entrLocation);
        }
        if (this.exitLocation != null) {
            map.put("exitLocation", this.exitLocation);
        }
        if (this.naviPoiid != null) {
            map.put("naviPoiid", this.naviPoiid);
        }
        if (this.gridcode != null) {
            map.put("gridcode", this.gridcode);
        }
        if (this.alias != null) {
            map.put("alias", this.alias);
        }
        if (this.businessArea != null) {
            map.put("businessArea", this.businessArea);
        }
        if (this.parkingType != null) {
            map.put("parkingType", this.parkingType);
        }
        if (this.tag != null) {
            map.put("tag", this.tag);
        }
        if (this.indoorMap != null) {
            map.put("indoorMap", this.indoorMap);
        }
        if (this.indoorData != null) {
            map.put("indoorData", this.indoorData);
        }
        if (this.groupbuyNum != null) {
            map.put("groupbuyNum", this.groupbuyNum);
        }
        if (this.discountNum != null) {
            map.put("discountNum", this.discountNum);
        }
        if (this.bizExt != null) {
            map.put("bizExt", this.bizExt);
        }
        if (this.photos != null) {
            map.put("photos", this.photos);
        }
        return map;
    }
}
